import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-carousel',
  templateUrl: './carousel.component.html',
  styleUrls: ['./carousel.component.scss']
})
export class CarouselComponent implements OnInit {

  // 声明产品
  private products: Array<Product>;

  constructor() { }

  ngOnInit() {
    this.products = [
      new Product(1,'第一个商品',0.01,3.5,'第1个商品',['书籍']),
      new Product(2,'第一个商品',0.01,3.5,'第2个商品',['书籍']),
      new Product(3,'第一个商品',0.01,3.5,'第3个商品',['书籍']),
      new Product(4,'第一个商品',0.01,3.5,'第4个商品',['书籍']),
      new Product(5,'第一个商品',0.01,3.5,'第5个商品',['书籍']),
      new Product(6,'第一个商品',0.01,3.5,'第6个商品',['书籍'])
    ]
  }

}


export class Product {

  // 构造函数
  constructor(
    public id: number,
    public title: string,
    public price: number,
    public rating: number,
    public desc: string,
    public categories: Array<string>
  ) {
  }
}